package com.wjy.simple.fragment;

import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.wjy.sfhcore.ui.fragment.AbsTabsFragment;
import com.wjy.simple.R;

/**
 * Created by wangjingyuan on 15/6/2.
 */
public class MainFragment extends AbsTabsFragment {
    @Override
    protected void addTabs() {
        addTab(initTabView(R.drawable.icon_nearby,
                R.string.nearby), DemoFragment.class, null);
        addTab(initTabView(R.drawable.icon_order,
                R.string.order), LoadDemoFragment.class, null);
        addTab(initTabView(R.drawable.icon_me, R.string.me), MeFragment.class, null);

    }

    private View initTabView(int resID, int stringResID) {
        View view = LayoutInflater.from(baseActivity).inflate(R.layout.main_tab_item,
                null);
        ImageView iv_tab = (ImageView) view.findViewById(R.id.iv_tab);
        TextView tv_tab = (TextView) view.findViewById(R.id.tv_tab);
        iv_tab.setImageResource(resID);
        tv_tab.setText(stringResID);
        return view;
    }

    @Override
    public void menuListener(MenuItem item) {

    }

    @Override
    public void initBackButton() {
        baseActivity.finish();
    }

    @Override
    public boolean isUseToolBar() {
        return true;
    }
}
